<?php
	class Job extends AppModel {
    var $name = 'Job';
    var $hasAndBelongsToMany = array(
            'User' => array('className' => 'User',
                        'joinTable' => 'jobs_users',
                        'foreignKey' => 'job_id',
                        'associationForeignKey' => 'user_id',
                        'unique' => true
            ),
            'Skill' => array('className' => 'Skill',
                        'joinTable' => 'jobs_skills',
                        'foreignKey' => 'job_id',
                        'associationForeignKey' => 'skill_id',
                        'unique' => true
            )
            );
    //function beforeSave()
//    {
//        if (isset($this->data['Job']['edate']) || (isset($this->data['Job']['sdate'])))
//        {
//       $this->data['Job']['sdate'] = $this->dateFormatBeforeSave($this->data['Job']['sdate']);
//       $this->data['Job']['edate'] = $this->dateFormatBeforeSave($this->data['Job']['edate']);
//       }
//       return true;
//    }
//function afterFind($results)
//{
//    foreach ($results as $key => $val)
//    {
//        if (isset($val['Job']['sdate']))
//        {
//            $results[$key]['Job']['sdate'] = $this->dateFormatAfterFind($val['Job']['sdate']);
//            $results[$key]['Job']['edate'] = $this->dateFormatAfterFind($val['Job']['edate']);
//        }
//    }
//    return $results;
//}
//
function dateFormatAfterFind($dateString)
{
    return date('m/d/Y', strtotime($dateString));
}

function dateFormatBeforeSave($dateString)
{
    return date('Y-m-d', strtotime($dateString));
}

 
}

?>